package com.kitty.game.equip.newservice;

import com.kitty.game.bag.message.RespIconCartoon;
import com.kitty.game.base.service.BagService;
import com.kitty.game.config.OnlineMall;
import com.kitty.game.config.SpecialItem;
import com.kitty.game.equip.message.RespNotifyMiscEx;
import com.kitty.game.fly.FlyTypeEnums;
import com.kitty.game.onlinemall.MallDataPool;
import com.kitty.game.role.model.Role;
import com.kitty.mina.cache.DataCache;
import com.kitty.mina.message.MessagePusher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.MessageFormat;

@Service
public class NewEquipService {
    @Autowired
    BagService bagService;
    /**
     * 添加物品
     */
    public void newAddItem(String name, boolean isGold, Role role, int num) {
        //获取物品
        SpecialItem specialItem = MallDataPool.name2SpecialItem.get(name);
        //判断是否可叠加
        boolean combined = specialItem.isCombined();



        OnlineMall onlineMall = DataCache.NAME_MALL.get(name);
        if (onlineMall == null ) {
            int type = FlyTypeEnums.getType(name);
            if(type>0){
                onlineMall = new OnlineMall();
                onlineMall.setName(name);
                onlineMall.setItemtype((short) 34);
                onlineMall.setType(260);
            }else{
                onlineMall = new OnlineMall();
                onlineMall.setName(name);
                onlineMall.setItemtype((short) 10);
                onlineMall.setType(260);
            }


        }
        if(name!=null && name.contains("梦荷")){
            isGold = true ;
        }

//        bagService.addRoleEquip(role, isGold, num, onlineMall);
//        MessagePusher.pushMessage(role, new RespIconCartoon(name));
//
//        String itemUnit = getItemUnit(name);
//        String msg = MessageFormat.format("你获得了#R{0}#n{1}#R{2}#n。", num, itemUnit, name);
//        MessagePusher.pushMessage(role, new RespNotifyMiscEx(msg));
    }
}
